package com.sk.netty.client;

import com.sk.netty.server.EchoServerHandlerOut;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.SocketAddress;
@ChannelHandler.Sharable
public class EchoClientHandlerOut extends ChannelOutboundHandlerAdapter {
    Logger logger = LoggerFactory.getLogger(EchoServerHandlerOut.class);

    @Override public void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise)
            throws Exception {
        super.bind(ctx, localAddress, promise);
        logger.info("----bind----");
    }

    @Override public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress,
            ChannelPromise promise) throws Exception {
        super.connect(ctx, remoteAddress, localAddress, promise);
        logger.info("----connect----");
    }

    @Override public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
        super.disconnect(ctx, promise);
        logger.info("----disconnect----");
    }

    @Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
        super.close(ctx, promise);
        logger.info("----close----");
    }

    @Override public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
        super.deregister(ctx, promise);
        logger.info("----deregister----");
    }

    @Override public void flush(ChannelHandlerContext ctx) throws Exception {
        super.flush(ctx);
        logger.info("----flush----");

    }

    @Override public void read(ChannelHandlerContext ctx) throws Exception {
        super.read(ctx);
        logger.info("----read----");
    }

    @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        super.write(ctx, msg, promise);
        logger.info("----write----");
    }

}
